public class SolutionCount {
    private static boolean alreadyAssignedCount = false;
    public static boolean hasAlreadyAssignedCount() 
    {
    return alreadyAssignedCount;
    }
    public static void setAlreadyAssignedCount() 
    {
    alreadyAssignedCount = true;
    }
	public static void assignCount(case[] cases)
    {
        if (!SolutionCount.hasAlreadyAssignedCount()) 
        { 		
			CaseSolution[] cs = [SELECT id,CaseId FROM CaseSolution WHERE CaseId in :cases AND CaseId != Null];
			{	
				Map<Id,boolean> CaseSolutionMap = New Map<Id,boolean>();
				for (integer i = 0; i < cs.size(); i++)
				{
					CaseSolutionMap.put(cs[i].CaseId,true);
				}
				for (Case c : cases)
				{
					If(caseSolutionMap.get(c.id)!=Null)
					{
						c.Solution_Assigned__c = caseSolutionMap.get(c.id);
					}
					else
					{
						c.Solution_Assigned__c = false;
					}
				}
			}
        setAlreadyAssignedCount();			
        }
    }

}